#!/bin/sh


find src -type f -name "*.cpp" -print0 | xargs -0 clang-tidy --config-file=.clang-tidy -p=build/ninja-release

if [ "$?" -ne 0 ]
then
    echo "clang-tidy check failed"
    exit 1
fi

find include -type f -name "*.h" -print0 | xargs -0 clang-tidy --config-file=.clang-tidy -p=build/ninja-release

if [ "$?" -ne 0 ]
then
    echo "clang-tidy check failed"
    exit 1
fi

find test -type f -name "*.cpp" -print0 | xargs -0 clang-tidy --config-file=.clang-tidy -p=build/ninja-release

if [ "$?" -ne 0 ]
then
    echo "clang-tidy check failed"
    exit 1
fi

# If everything is OK, continue with the commit
